package com.atguigu.spzx.manager.service.Impl;

import com.atguigu.spyx.model.common.com.atguigu.spyx.model.entity.sys.SysRole;
import com.atguigu.spzx.manager.mapper.SysRoleMapper;
import com.atguigu.spzx.manager.service.SysRoleService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author LT
 * @create 2023-11-03-19:08
 */
@Service
public class SysRoleServiceImpl implements SysRoleService {
    @Resource
    SysRoleMapper sysRoleMapper;


    @Override
    public PageInfo<SysRole> getPage(Integer pageNum, Integer pageSize, String keyword) {

        PageHelper.startPage(pageNum,pageSize);

        List<SysRole> roleList = sysRoleMapper.getPage(keyword);
        return new PageInfo<>(roleList);
    }

    @Override
    public void deleteById(Integer id) {
        sysRoleMapper.deleteById(id);
    }

    @Override
    public SysRole GetRoleById(Integer id) {
        return sysRoleMapper.GetRoleById(id);
    }

    @Override
    public void UpdateRoleById(SysRole role) {
        sysRoleMapper.UpdateRoleById(role);
    }

    @Override
    public void saveRole(SysRole role) {
        sysRoleMapper.saveRole(role);
    }

    @Override
    public List<SysRole> getRole(Long id) {
        List<SysRole> roles = sysRoleMapper.getRole(id);
        return roles;
    }
}
